﻿$("#cmbInquiryFollowSearchType").bind("change", function (e) {
    $('#txtInquiryFollowSearchValue').val('').css('color', '').removeAttr('noChecked');
    $("#txtInquiryFollowSearchValue").unbind('focus').unbind('blur');
    $('#txtInquiryFollowSearchValue').unbind('keyup');
    if ($(this).val() == "0") {
        $("#txtInquiryFollowSearchValue").hide();
    } else if ($(this).val() == "1") {
        agencyVerify.nonnegativeIntInput("#txtInquiryFollowSearchValue", false);
        $("#txtInquiryFollowSearchValue").show();
    } else {
        $('#txtInquiryFollowSearchValue').val('');
        $("#txtInquiryFollowSearchValue").show();
    }
});
//盘源归属
var SearchRank = 0;
if (customerRight.CheckRight("Customer.Inquiry.Search-All")) {
    SearchRank = 1;
}
else if (customerRight.CheckRight("Customer.Inquiry.MyDepartment")) {
    SearchRank = 3;
}
else if (customerRight.CheckRight("Customer.Inquiry.MySelf")) {
    SearchRank = 4;
}
EmployeePrompt.getDepartAndEmployeeByInput('txtDepartmentName', 'txtDepartmentKeyId', 'txtEmployeeName', 'txtTakeSeeUserKeyId', false, 'private', SearchRank, "请输入业务姓名", "请输入部门名称", true, false);

//清空事件
$("#btnClear").bind("click", function () {
    $("#txtInquiryFollowSearchValue").hide();
    $('#txtInquiryFollowSearchValue').val('').css('color', '').removeAttr('noChecked');
    $("#txtDepartmentKeyId").val("");
    $("#txtTakeSeeUserKeyId").val("");

    //mayu:重置公客池combobox
    $('#publicAccountSelector').combobox('clear');
    $('input.textbox-text.validatebox-text').attr('value', '公客池');
});
$(function () {

    //mayu:非选项值校验
    $('input.textbox-text.validatebox-text').blur(function () {
        //  获得输入值  
        var inputV = $('#publicAccountSelector').combobox('getText');
        var datas = $('#publicAccountSelector').combobox('getData');
        var size = datas.length;
        if (inputV == "" || size == 0) {
            
            return;
        } else {
            for (var i = 0; i < size; i++) {
                if (inputV === datas[i].text) {
                    return;
                }
            }
            $('#publicAccountSelector').combobox('clear');
            $('input.textbox-text.validatebox-text').attr('value', '公客池');
        }
    });

    $('span.textbox.combo').css('width', '').css('height', '');
    $('span.textbox.combo').attr('class', 'outerSpan textbox combo');
    $('input.textbox-text.validatebox-text').attr('value', '公客池');
    $('input.textbox-text.validatebox-text').css('width', '195px');
    $('a[class="textbox-icon combo-arrow"]').css('height', '26px');





    //浮动的工具栏 yjj添加
    var state1 = true; //存储顶部显示的状态
    $(window).scroll(function () {
        if ($(window).scrollTop() > $("#ajaxPages").offset().top) {
            if (state1) {
                //执行浮动层出现后的代码
                $("#editToolsBox").addClass("float-edit-toos");
                //表头排序
                $('.fixed-div div').find(".fixed-span").unbind("click");
                $('.fixed-div div').find(".fixed-span").click(function () {
                    var resultVal = $(this).attr('callValue');
                    if (resultVal) {
                        $('#hiddenSortValue').val(resultVal);
                        $('#searchForm').submit();
                    }
                });

                $(".fixed-div").show();
                $("#gdIndexCustomerList .thead").css("visibility", "hidden");
                $("#thead .last").css("width", "100px");
            }
            state1 = false;
        } else {
            if (!state1) {
                //执行浮动层出现前的代码
                $("#editToolsBox").removeClass("float-edit-toos");
                $(".fixed-div").hide();
                $("#gdIndexCustomerList .thead").css("visibility", "visible");
                $("#thead .last").css("width", "100px");
            }
            state1 = true;
        }
        $(".tab-panel-wrapper").scroll(function () {
            var l = $(".tab-panel-wrapper").scrollLeft();
            $(".fixed-div div").css("margin-left", "-" + l + "px");
        });
    });
})